package com.acme.domain.listener;

import com.acme.domain.Order;

abstract class StockListener {
	
	protected String username;
	
	
	public StockListener(String username) {
		this.username = username;
	}
	
	abstract void updateInfo(Order o);

	public boolean equals(Object obj) {
		if (obj == null){
			return false;
		} else if (!(obj instanceof StockListener) && !(obj instanceof String)){
			return false;
		} else if ( (obj instanceof StockListener) && 
				!( this.username.equals( ( (StockListener)obj).getUsername() ))){
			return false;		
		} else if ( (obj instanceof String) && !(this.username.equals((String)obj))) {
			return false;
		} else {
			return true;
		}
	}
	
	

	@Override
	public int hashCode() {
		return username.hashCode();
	}

	public String getUsername() {
		return username;
	}
	
	
}
